/*
* Copyright (c) 2025 Huawei Device Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including but not limited to the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to provide persons with access to the Software
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGE OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

<template>
  <div class='first-page'>
    <span class='go-music-list' @click='goMusicList'>歌单页</span>
  </div>
</template>

<script lang='ts' setup>
import { useRouter } from 'vue-router';
import { ref, onMounted } from 'vue';
import { useStore } from 'vuex';
import { addMusicList } from '../../utils/common';

const router = useRouter();
const store = useStore();
const musicListNum = ref<number>(store.state.musicListNum);
const goMusicList = (): void => {
  router.push('/musicList');
};

onMounted(() => {
  const musicList = addMusicList(musicListNum.value);
  store.commit('addMusiclist', musicList);
  sessionStorage.setItem('musicList', JSON.stringify(musicList));
});
</script>

<style lang='less' scoped>
.first-page {
  background-color: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  padding: 16px;
  box-sizing: border-box;

  .go-music-list {
    width: 100%;
    font-size: 16px;
    color: #fff;
    height: 40px;
    line-height: 40px;
    cursor: pointer;
    border-radius: 20px;
    background: rgb(10, 89, 247);
    text-align: center;
    margin-bottom: 15px;
  }
}
</style>